<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

<ui:composition template="/css/template.xhtml">
	<ui:define name="main">
		<rich:panel style="text-align:center;margin:auto;width:70%;">
			<f:facet name="header">Suas Contas</f:facet>
			<h:messages errorStyle="color:red" warnStyle="color:yellow"
				infoStyle="color:green" />
			<h:form>
				<h:panelGroup style="text-align:center;margin:auto;">
					<rich:dataTable id="tabContas"
						value="#{contaBean.listaContasByLogado}" var="c"
						style="text-align:center;margin:auto" rows="10">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column colspan="5">
									<h:outputText value="Contas" />
								</rich:column>
								<rich:column breakBefore="true">
									<h:outputText value="titulo" />
								</rich:column>
								<rich:column>
									<h:outputText value="valor" />
								</rich:column>
								<rich:column>
									<h:outputText value="data de Vencimento" />
								</rich:column>
								<rich:column>
									<h:outputText value="status" />
								</rich:column>
								<rich:column>
									<h:outputText value="pagar" />
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						<rich:column sortBy="#{c.nome}" filterBy="#{c.nome}"
							filterEvent="onkeyup" styleClass="rich-filter-input">
							<h:outputText value="#{c.nome}" />
						</rich:column>
						<rich:column sortBy="#{c.valor}" filterBy="#{c.valor}"
							filterEvent="onkeyup">
							<h:outputText value="#{c.valor}" />
						</rich:column>
						<rich:column sortBy="#{c.dataVencimento}"
							filterBy="#{c.dataVencimento}" filterEvent="onkeyup">
							<h:outputText value="#{c.dataVencimento}">
								<f:convertDateTime pattern="dd/MM/yyyy" />

							</h:outputText>
						</rich:column>
						<rich:column sortBy="#{c.status}" filterBy="#{c.status}"
							filterEvent="onkeyup">
							<h:outputText value="#{c.status==true?'pago':'nao pago'}" />
						</rich:column>
						<rich:column>
							<a4j:commandButton
								actionListener="#{contaBean.pagarContaActionListener}"
								ajaxSingle="true" value="pagar" reRender="tabContas"
								disabled="#{c.status}">
								<f:attribute name="contaRow" value="#{c}" />
							</a4j:commandButton>
						</rich:column>
						<f:facet name="footer">
							<rich:datascroller for="tabContas" renderIfSinglePage="false" />
						</f:facet>
					</rich:dataTable>
				</h:panelGroup>
			</h:form>
		</rich:panel>
	</ui:define>
</ui:composition>

</html>